package tuanvn.iti.vn;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import mrtran.iti.vn.Main;
import mrtran.iti.vn.Main.GameView;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;

public class SpriteKimCuong2 {
	private GameView gameView;
	private Bitmap bmp;
	private int  width,height;
	public static int  yKimCuong2=(int) (Main.SCREENHEIGHT/1.8);
	public static int xKimCuong2;	
	public static int widthLuffyKimCuong2,KimCuongWidth2;	
	public static int xKimCuongCenter2,yKimCuongCenter2;	
	public static int distanceKimCuong2;
	private List<SpriteKimCuong2> spriteKimCuong2;
		
	public SpriteKimCuong2(GameView gameView2, Bitmap bmp,List<SpriteKimCuong2> spriteKimCuong2,int xKimCuong3, int yKimCuong3) {
		this.gameView = gameView2;
		this.bmp = bmp;
		this.height=bmp.getHeight();
		this.width=bmp.getWidth();	
		this.xKimCuong2= xKimCuong2;
		this.yKimCuong2=yKimCuong2;
		Random rnd = new Random();
		xKimCuong2 = rnd.nextInt(gameView.getWidth()-width);
		this.spriteKimCuong2 = spriteKimCuong2;
	}

	private void update() {
		if (distanceKimCuong2 < widthLuffyKimCuong2) {
			Main.jewel = Main.jewel + 1;
			spriteKimCuong2.remove(this);
			}	

		xKimCuongCenter2 = (int) (xKimCuong2+width/2);
		yKimCuongCenter2 = (int) (yKimCuong2+height/2);
		KimCuongWidth2= width/2;
	}

	public void onDraw(Canvas canvas) {
		update();
		canvas.drawBitmap(bmp, xKimCuong2, yKimCuong2, null);
	}
}
